package ute.mvc.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.transaction.annotation.Transactional;

import com.fasterxml.jackson.annotation.JsonIgnore;

@Entity
public class Course implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = -7202880330319411695L;

	@Id
	@Column (length = 20)

	private String courseId;
	
	@Column (length = 100, nullable = false)
	private String courseName;
	
	@JsonIgnore
	@OneToMany (mappedBy = "course", fetch = FetchType.LAZY)
	private Collection<OpenCourse> listOpenCourse = new ArrayList<OpenCourse>();
	
	public Collection<OpenCourse> getListOpenCourse() {
		return listOpenCourse;
	}
	public void setListOpenCourse(Collection<OpenCourse> listOpenCourse) {
		this.listOpenCourse = listOpenCourse;
	}
	@NotEmpty
	public String getCourseId() {
		return courseId;
	}
	public void setCourseId(String courseId) {
		this.courseId = courseId;
	}
	@NotEmpty
	public String getCourseName() {
		return courseName;
	}
	public void setCourseName(String courseName) {
		this.courseName = courseName;
	}
	
}
